package com.zoro.barn.business.service.sqldocument.server.facade;

import com.zoro.barn.business.service.sqldocument.server.BarnProductServer;
import com.zoro.barn.dto.pp.product.BarnProductInfoDto;
import com.zoro.barn.dto.pp.product.productinfodto.GetProductInfoInfosReq;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author zhaoxingwu
 */
@Component
public class BarnProductServerFacade {
    private final BarnProductServer barnProductServer;

    public BarnProductServerFacade(BarnProductServer barnProductServer) {
        this.barnProductServer = barnProductServer;
    }

    public Map<String, BarnProductInfoDto> getProductMap(String[] productIds) throws Exception {
        GetProductInfoInfosReq req = new GetProductInfoInfosReq();
        req.setIds(productIds);
        return this.barnProductServer.getProductInfos(req);
    }
}
